package com.cc.openeye.dynamic.recommend.entity.dynamicResponse

import kotlinx.serialization.Serializable

@Serializable
data class Data(
    val adTrack: String? = null,
    val content: Content? = null,
    val count: Int? = null,
    val dataType: String,
    val footer: Footer? = null,
    val header: Header? = null,
    val itemList: List<ItemX>? = null
) {

    private var height: Float = 0f

    private fun getWhProportion(): Float {
        return content?.data?.getWhProportion() ?: 1f
    }

    fun getHeight(width: Float): Float {
        if (height == 0f) {
            height = width / getWhProportion()
        }
        return height
    }

    fun getImage() = content?.data?.cover?.detail ?: ""
}

@Serializable
class Footer